package com.speljohan.rsbot.script.wrappers;

import com.speljohan.rsbot.accessors.ItemDef;
import com.speljohan.rsbot.script.Calculations;

/**
 * INVENTORY/bank item.
 * */
public class RSItem {
	int id;
	int stack;

	public RSItem(final int id, final int stack) {
		this.id = id;
		this.stack = stack;
	}

	public RSItemDef getDefinition() {
		try {
			return new RSItemDef((ItemDef) Calculations.findNodeByID(id));
		} catch (final ClassCastException e) {
			return null;
		}
	}

	public int getID() {
		return id;
	}

	public int getStackSize() {
		return stack;
	}

	public boolean hasDefinition() {
		return getDefinition() != null;
	}

}
